#!/usr/bin/env ruby
#^syntax detection

version ">= 1.5.1"

node 'vagrant' do

  provider      TestLab::Provider::Vagrant

  provisioners  [
    TestLab::Provisioner::Raring,
    TestLab::Provisioner::AptCacherNG,
    TestLab::Provisioner::Bind,
    TestLab::Provisioner::Resolv
  ]

  config      ({
    :vagrant => {
      :id       => "test-cucumber-#{TestLab.hostname}".downcase,
      :cpus     => ZTK::Parallel::MAX_FORKS.div(2),                    # use half of the available processors
      :memory   => ZTK::Parallel::MAX_MEMORY.div(3).div(1024 * 1024),  # use a third of available RAM
      :box      => 'raring64',
      :box_url  => 'https://dl.dropboxusercontent.com/u/22904185/boxes/raring64.box',
      :file     => File.dirname(__FILE__)
    }
  })

  network 'labnet' do
    provisioners  [
      TestLab::Provisioner::Route,
      TestLab::Provisioner::Bind
    ]

    address       '10.128.0.1/16'
    bridge        'br0'
  end

  container "test-server" do
    distro        "ubuntu"
    release       "precise"

    provisioners   [
      TestLab::Provisioner::Resolv,
      TestLab::Provisioner::Bind,
      TestLab::Provisioner::AptCacherNG,
      TestLab::Provisioner::Apt
    ]

    user do
      username         'deployer'
      password         'deployer'
      identity         File.join(ENV['HOME'], '.ssh', 'id_rsa')
      public_identity  File.join(ENV['HOME'], '.ssh', 'id_rsa.pub')
      uid              2600
      gid              2600
    end

    interface do
      network_id  'labnet'
      name        'eth0'
      address     '10.128.0.254/16'
      mac         '00:00:5e:63:b5:9f'
    end

    interface do
      network_id  'labnet'
      name        'eth1'
      address     '10.128.0.253/16'
      mac         '00:00:5e:63:b5:9e'
    end
  end

end
